package l.l.w.leetcode._300_LongestIncreasingSubsequence;

/**
 * Created by llw on 2018/5/29/0029.
 */
public class _300_LongestIncreasingSubsequence {
    public int lengthOfLIS(int[] nums) {
        if(nums == null || nums.length == 0) return 0;
        int[] flag = new int[nums.length];
        for(int i = 0; i < nums.length; ++i){
            flag[i] = Integer.MAX_VALUE;
        }
        for(int i = 0; i < nums.length; ++i){
            for(int k = 0; k < nums.length; ++k){
                if(nums[i] <= flag[k]){
                    flag[k] = nums[i];
                    break;
                }
            }
        }
        int i = 0;
        while(i < nums.length && flag[i] != Integer.MAX_VALUE){
            i++;
        }
        return i;
    }

    public static void main(String[] args) {
        int[] nums = {2,2};
        int result = new _300_LongestIncreasingSubsequence().lengthOfLIS(nums);
        System.out.println(result);
    }
}
